package com.zjweu.hkg.DAO;

import com.zjweu.hkg.POJO.River;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface HydroMysql {

    @Select("select * from River")
    List<River> findALLRiverFromMysql();

    @Delete("delete from River")
    void deleteRiver();
    @Insert({
            "<script>",
            "INSERT INTO River (name, length, averageWidth, `from`, `to`, level, ",
            "waterArea, waterVolume, flowTown, riverBasin, landforms, mainFunction) VALUES ",
            "<foreach collection='riverList' item='river' index='index' separator=','>",
            "(#{river.name}, #{river.length}, #{river.averageWidth}, #{river.from}, ",
            "#{river.to}, #{river.level}, #{river.waterArea}, #{river.waterVolume}, ",
            "#{river.flowTown}, #{river.riverBasin}, #{river.landforms}, #{river.mainFunction})",
            "</foreach>",
            "</script>"
    })
    void insertRiverByList(@Param("riverList")List<River> riverList);

}
